#include <iostream>
#include "message.pb.h"
#include <string>

int main()
{
    // 测试序列化和反序列化
    Info::studentInfo stu1;
    stu1.set_name("张三");
    stu1.set_age(20);
    std::string data;
    if(!stu1.SerializeToString(&data))
    {
        std::cout << "序列化数据失败" << std::endl;
        return -1;
    }
    std::cout << "数据序列化成功 : " << data << "\n";

    // 反序列化数据
    Info::studentInfo stu;
    if(!stu.ParseFromString(data))
    {
        std::cout << "数据反序列化失败" << "\n";
        return -1;
    }
    std::cout << "数据反序列化成功 : " << "\n";
    std::cout << "name : " << stu.name() << "\n";
    std::cout << "age : " << stu.age() << "\n";


    return 0;
}